package com.bflow.api.bo;

import com.bflow.api.constant.BflowConstant;
import com.bflow.commons.consts.CommConst;
import com.bflow.commons.util.StrUtil;

import java.io.Serializable;
import java.util.List;

/**
 * 功能：BflowRunTask 任务-BO(business object)业务对象
 * 作者：haowen
 * 日期：2018-12-13
 */
public class BflowRunTaskBo implements Serializable {

    private static final long serialVersionUID = -622229976534939493L;
	
    /**
     * ID
	 */
	private String id;

	private String procId;
    /**
     * 流程实例ID
	 */
	private String instanceId;



    /**
     * 活动ID
	 */
	private String actId;

    /**
     * 代办者标识
	 */
	private String userKey;

    /**
     * 代办者名称
	 */
	private String userName;

    /**
     * 委托人(二次代办人)
	 */
	private String secondUserId;

    /**
     * 委托人名称(二次代办人)
	 */
	private String secondUserName;

    /**
     * 状态：0-待处理；1-已处理；
	 */
	private String status;

    /**
     * 创建者ID
	 */
	private String createUid;

    /**
     * 创建者姓名
	 */
	private String createUname;

    /**
     * 创建时间
	 */
	private java.util.Date createTime;

    /**
     * 完成时间
	 */
	private java.util.Date finishTime;

    /**
     * 删除标记：0-已删除；1-有效；
	 */
	private String delFlag;

	/** 版本号 */
	private Integer version;

	 /**
	  * 实例信息
	  */
	private BflowRunInstanceBo instance;

	 /**
	  * 活动信息
	  */
	private BflowDefineActBo act;


	/**
	 * 流程实例
	 */
	private BflowDefineProcessBo process;

	//流程历史
	private List<BflowRunRecordBo> historyList;

	/**
	 * 活动路由条件列表
	 */
	private List<BflowDefineActRouteBo> actRoutes;


	private BflowDefineActBo nextAct;

	private BflowDefineActBo prevAct;


	public BflowDefineActBo getNextAct() {
		return nextAct;
	}

	public void setNextAct(BflowDefineActBo nextAct) {
		this.nextAct = nextAct;
	}

	public BflowDefineActBo getPrevAct() {
		return prevAct;
	}

	public void setPrevAct(BflowDefineActBo prevAct) {
		this.prevAct = prevAct;
	}

	public BflowRunTaskBo(){
	}

	public BflowRunTaskBo( String id ){
		this.id = id;
	}

	public String getId() {
		return this.id;
	}
	public void setId(String id) {
		this.id = id;
	}

	public String getProcId() {
		return this.procId;
	}
	public void setProcId(String procId) {
		this.procId = procId;
	}

	public String getInstanceId() {
		return this.instanceId;
	}
	public void setInstanceId(String instanceId) {
		this.instanceId = instanceId;
	}

	public String getActId() {
		return this.actId;
	}
	public String getActIdVal() {
		//对于 系统默认活动 可能会有  _活动序号 (例如 请假, 对于流程的活动集合会有重复活动)
		if(StrUtil.isNotBlank(actId))
			return this.actId.split(BflowConstant.UNDERLINE)[0];
		return this.actId;
	}
	public void setActId(String actId) {
		this.actId = actId;
	}

	public Integer getActSort(){
		if(StrUtil.isNotBlank(actId)){
			String[] arr = actId.split(BflowConstant.UNDERLINE);
			if(arr.length > 1){
				return Integer.parseInt(arr[arr.length-1]);
			}
		}
		return null;
	}

	public String getUserKey() {
		return this.userKey;
	}
	public void setUserKey(String userKey) {
		this.userKey = userKey;
	}

	public String[] getUserKeys() {
		if(StrUtil.isBlank(userKey))
			return null;
		return this.userKey.split(",");
	}
	public int getUserKeysCount() {
		if(StrUtil.isBlank(userKey))
			return 0;
		return this.userKey.split(",").length;
	}

	public String getUserName() {
		return this.userName;
	}
	public void setUserName(String userName) {
		this.userName = userName;
	}

	public String getSecondUserId() {
		return this.secondUserId;
	}
	public void setSecondUserId(String secondUserId) {
		this.secondUserId = secondUserId;
	}

	public String getSecondUserName() {
		return this.secondUserName;
	}
	public void setSecondUserName(String secondUserName) {
		this.secondUserName = secondUserName;
	}

	public String getStatus() {
		return this.status;
	}
	public void setStatus(String status) {
		this.status = status;
	}

	public String getCreateUid() {
		return this.createUid;
	}
	public void setCreateUid(String createUid) {
		this.createUid = createUid;
	}

	public String getCreateUname() {
		return this.createUname;
	}
	public void setCreateUname(String createUname) {
		this.createUname = createUname;
	}

	public java.util.Date getCreateTime() {
		return this.createTime;
	}
	public void setCreateTime(java.util.Date createTime) {
		this.createTime = createTime;
	}

	public java.util.Date getFinishTime() {
		return this.finishTime;
	}
	public void setFinishTime(java.util.Date finishTime) {
		this.finishTime = finishTime;
	}

	public String getDelFlag() {
		return this.delFlag;
	}
	public void setDelFlag(String delFlag) {
		this.delFlag = delFlag;
	}

	public Integer getVersion() {
	 return this.version;
	}
	public void setVersion(Integer version) {
	 this.version = version;
	}
	 public BflowDefineActBo getAct() {
		 return act;
	 }

	public void setAct(BflowDefineActBo act) {
		 this.act = act;
	 }

	public BflowRunInstanceBo getInstance() {
		return instance;
	}

	public void setInstance(BflowRunInstanceBo instance) {
		this.instance = instance;
	}

	public List<BflowRunRecordBo> getHistoryList() {
		return historyList;
	}

	public void setHistoryList(List<BflowRunRecordBo> historyList) {
		this.historyList = historyList;
	}

	public List<BflowDefineActRouteBo> getActRoutes() {
		return actRoutes;
	}

	public void setActRoutes(List<BflowDefineActRouteBo> actRoutes) {
		this.actRoutes = actRoutes;
	}
	public BflowDefineProcessBo getProcess() {
		return process;
	}

	public void setProcess(BflowDefineProcessBo process) {
		this.process = process;
	}

}

